<script type="text/javascript">

      window.oemcart_current_route_handle = '{{ routes.current_route_handle | default : "" }}';

      const messageParams = {}

      {% if payment %}
        messageParams['payment'] = {{ payment | json }};
      {% endif %}

      {% if comments %}
        messageParams['comments'] = {{ comments | json }};
      {% endif %}


      {% if collections %}
        messageParams['collections'] = {{ collections | json }};
      {% endif %}

      {% if template == 'coupon_detail' %}
        messageParams['coupon'] = {{ coupon | json }};
        messageParams['coupon_view_config'] = {{ coupon_view_config | json }};
        messageParams['sort_options'] = {{ sort_options | json }};
      {% endif %}

      {% if template == 'promotion_detail' %}
        messageParams['promotion'] = {{ promotion | json }};
        messageParams['promotion_view_config'] = {{ promotion_view_config | json }};
        messageParams['sort_options'] = {{ sort_options | json }};
      {% endif %}


      moi.setPageStorage("messageParams",messageParams )

      {% if template == 'product_detail' %}
        moi.setPageStorage('page_id', {{product.id | default : 0}});
      {% endif %}


      

      {% if template == 'collection_detail' %}
        moi.setPageStorage('page_id', {{collection.id | default : 0}});
      {% endif %}
</script>

<script type="text/javascript" src="{{ 'message.js' | public_asset_abs_url }}"></script>